#ifndef VIEWPORTCONTROL_H
#define VIEWPORTCONTROL_H
#include <QObject>
#include "Ptr.hpp"
#include "Viewport.h"

using namespace OOPUtils;

class ViewportControl : public QObject
{

  Q_OBJECT

private:

  Ptr< Viewport > _pViewport;
  Ptr< QRect > _pCanvasRegion;

public:

  ViewportControl (Ptr< QRect > pCanvasRegion);
  ~ViewportControl ();



  QPoint getViewportTranslate () const { return _pViewport->getTranslate (); }
  QSize getViewportSize () const { return _pViewport->getSize (); }
  QRect getPaintRegion () const;
  QRect getImageRegion () const;
  QRect getCanvasRegionInViewport () const;
  QPoint viewportToImage (const QPoint & pointInViewport) const;
  QPoint imageToViewport (const QPoint & pointInImage) const;

public slots:

  void viewportMoveTo (QPoint newCenter);
  void viewportResizeTo (QSize newSize);

signals:

  void repaintViewport ();

};

#endif // VIEWPORTCONTROL_H
